package com.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.common.utils.PageUtils;
import com.common.utils.Query;
import com.dao.TeacherDao;
import com.entity.TeacherEntity;
import com.service.TeacherService;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service("teacherService")
public class TeacherServiceImpl extends ServiceImpl<TeacherDao, TeacherEntity> implements TeacherService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<TeacherEntity> page = this.page(
                new Query<TeacherEntity>().getPage(params),
                new QueryWrapper<TeacherEntity>()
                        .or().like("teacherid",params.get("key"))
                        .or().like("teachername",params.get("key"))
                        .or().like("institute",params.get("key"))
                        .or().like("tel",params.get("key"))
                        .or().like("email",params.get("key"))
                        .or().like("cardid",params.get("key"))
                        .or().like("type",params.get("key"))
        );

        return new PageUtils(page);
    }

}